package com.citycloud.ccuap.tc.oauth2.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
public class PasswordEncoderConfiguration {

    /** 设置默认的加密方式 */
    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }

    public static void main(String[] args) { /*加密方式测试*/
    	PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
    	System.out.println(passwordEncoder.encode("db6888615a0a4a28a43a9830250ad852"));
    	
        System.out.println(PasswordEncoderFactories.createDelegatingPasswordEncoder().encode("oauth2-resource"));
    }

}
